﻿using System;
using System.Web.UI;

namespace PM.Admin
{
    public partial class Admin1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["HasLogin"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            else
            {
                lblQTV.Text = Convert.ToString(Session["FullName"]);
                Session.Timeout = 30;
            }

            string typesubmit = null;
            Control ct;   
            PlaceHolder1.Controls.Clear();
            typesubmit = Request["typesubmit"];
            switch (typesubmit)
            {
                case "adv":
                    ct = Page.LoadControl("ctrUser/ctrAdvertise.ascx");
                    break;
                case "grn":
                    ct = Page.LoadControl("ctrUser/ctrGroupNews.ascx");
                    break;
                case "news":
                    ct = Page.LoadControl("ctrUser/ctrNews.ascx");
                    break;
                case "ur":
                    ct = Page.LoadControl("ctrUser/ctrUser.ascx");
                    break;
                default:
                    ct = Page.LoadControl("ctrUser/WebUserControl1.ascx");
                    break;
            }
            PlaceHolder1.Controls.Add(ct);
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            Response.Redirect("Login.aspx");
        }
           
        
    }
}